﻿using Prism.Regions;
using FrameWork.Core.Interface;
using FrameWork.Core.Infrastructure;

namespace FrameWork.Core.Base
{
    public class RegionBase
    {
        public static void RequestNavigate(string regionName, string pageName, NavigationParameters args = null)
        {
            if (EngineContext.Current.IsRegistered<IRegionProxy>(pageName))
            {
                var pageProxy = EngineContext.Current.Resolve<IRegionProxy>(pageName);
                if (null != pageProxy)
                    pageProxy.RequestNavigate(regionName, pageName, args);
            }
            else
            {
                var m_Region = EngineContext.Current.Resolve<IRegionManager>();
                m_Region.RequestNavigate(regionName, pageName, args);
            }
        }
    }
}
